package spring.jdbc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import org.testng.Assert;
import org.testng.annotations.Test;
import spring.jdbc.interfaces.IUserDao;
import spring.model.UserModel;

public class TestDao {
    @Test
    public void testBestPractice() {
        String[] configLocation = new String[]{"classpath:dao/application-resource-dao.xml", "classpath:dao/application-jdbc.xml"};
        ApplicationContext ctx = new ClassPathXmlApplicationContext(configLocation);
        IUserDao userDao = ctx.getBean(IUserDao.class);
        UserModel model = new UserModel();
        model.setMyName("test");
        Assert.assertEquals(1, userDao.countAll());
    }
}
